﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using AccessModel;
using DBUtility;
using MySql.Data.MySqlClient;

namespace AccessDAL
{
    public class RoleDAL
    {
        #region
        public int CreateNewRole(Role role)
        {
            string sql = "INSERT INTO ROLE (ROLENAME) VALUES ('" + role.RoleName + "')";          
      
            try
            {
                return DBUtility.MySqlHelper.ExecuteSql(sql);
            }
            catch (Exception)
            {
                throw;
            }

           
        }
        #endregion

        #region
        public int GetNewRoleId()
        {           
            string sql = "SELECT LAST_INSERT_ID()";         
            int i = 0;
            try
            {               
                i = DBUtility.MySqlHelper.ExecuteSql(sql);
            }
            catch (Exception)
            {
                throw;
            }

            return i;
        }
        #endregion
        
        
    }
}
